Skip to content

IPC: introduce new IPC message service and rework the Intel Audio DSP host IPC driver #91606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

dcpleung
Copy link
Member

This introduces a new IPC message service which is based on the idea of exchanging messages via IPC. This is in contrast to the other IPC service which is based on exchanging data as raw byte arrays.

The first customer of this new API is the Intel Audio DSP host IPC driver. It is reworked to be a backend to the IPC message service. This is the first step (of many) in moving host IPC communication in SOF (Sound Open Firmware) to utilizing a more generic API.

@dcpleung dcpleung requested review from kv2019i and nashif June 13, 2025 21:00
@dcpleung dcpleung force-pushed the intel_adsp/rework_ipc branch 9 times, most recently from cb760a0 to 241d4be Compare June 20, 2025 16:39
@dcpleung dcpleung force-pushed the intel_adsp/rework_ipc branch from 241d4be to 4900a7c Compare June 27, 2025 22:00
@nashif nashif added area: IPC Inter-Process Communication Architecture Review Discussion in the Architecture WG required labels Jun 30, 2025
Copy link
Contributor

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dcpleung this looks very good and the old-on-new layer will make it easy to integrate this. I'll try to test this tomorrow with SOF.

Link back to SOF ticket thesofproject/sof#9697

Deprecated config for IPC. Will be removed in the future.

config INTEL_ADSP_IPC_OLD_INTERFACE
bool "Expose old interface for the IPC"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is old-on-top-of-new is really cool and eases the transition!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I skimmed through the SOF code and I think it is possible to apply similar changes in common/ipc.c to utilize the new interface.

lgirdwood
lgirdwood previously approved these changes Jul 2, 2025
Copy link

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

kv2019i
kv2019i previously approved these changes Jul 2, 2025
Copy link
Contributor

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a test run with SOF on a ACE1.5 device (and using the old interface so no changes to SOF side yet) and seems to be working great. It worked so good I had to increase IPC_SERVICE log level a bit and verify it is really being used :) ... and it was.

/**
* @brief New packet arrived.
*
* This callback is called when new data is received.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we mention that it can be called in interrupt context?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a note in the doxygen.

if (ept_cfg->cb.event != NULL) {
int ret = ept_cfg->cb.event(INTEL_ADSP_IPC_EVT_DONE, NULL, ept_cfg->priv);

if (ret == INTEL_ADSP_IPC_EVT_RET_EXT_COMPELTE) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like a typo "COMPLETE"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -120,7 +120,7 @@ static void core_smoke(void *arg)
clk_ratios[cpu] / 1000, clk_ratios[cpu] % 1000);

for (int i = 0; i < cpu; i++) {
int32_t diff = MAX(1, abs(clk_ratios[i] - clk_ratios[cpu]));
int32_t diff = MAX(1, (uint32_t)llabs((int64_t)clk_ratios[i] - clk_ratios[cpu]));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would a simpler abs((int32_t)(clk_ratios[i] - clk_ratios[cpu])) be enough?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clock is not fast enough to need the signed bit. So we can do that to avoid 64-bit math.

@dcpleung dcpleung force-pushed the intel_adsp/rework_ipc branch 4 times, most recently from 3331b27 to 190f98c Compare July 18, 2025 18:02
This removes the IPM test from the intel_adsp smoke test.
The IPM driver is not being used by SOF and is there simply
for this test. The host IPC functionality is also being tested
via test_host_ipc. The additional usage of mailbox in the test
does not provide much value since the mailbox is shared memory
between the DSP and the host. We would have bigger problems if
the shared memory does not work properly.

Removing the test is in preparation to removing the CAVS host
IPM driver. That is also a preparation to rewrite the host IPC
driver to the IPC API, and there is no need to maintain
another host IPC driver that is not used by SOF.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
dcpleung added 12 commits July 18, 2025 17:39
This IPM driver is not being used by SOF and is there simply for
a test which does not provide much additional value compared to
the existing host IPC tests. That IPM specific test has been
removed so there is no need to keep this driver in the tree.
This is in preparation to rewrite the host IPC driver to utilize
the IPC API. There is no need to maintain another driver that is
not being used in SOF.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The SoC specific IPC driver is for host IPC, and not IDC (which
is between CPUs). So there is no need to use the IDC devicetree
binding to enable the kconfig.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This introduces a new IPC mechanism: IPC message service, where
IPC transactions are centered around messages instead of raw
byte streams. This provides a bit more clarity in the code as
this shows what type of message is being sent. This also allows
backend to select the delivery mechanism based on the message
type for supported hardware.

This models after the existing IPC service and backend.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This adds a few basic tests for the IPC message service.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This reworks the host IPC driver as a backend of the newly
introduced IPC message service. This is the first step to
rework IPC in SOF (Sound Open Firmware) into using a more
generic IPC API instead of a SoC specific one.

For now, it keeps the old interface to maintain usability
as it is going to be a multiple process to rework IPC
over there.

Also, the structure of the new IPC backend resembles
the SoC specific driver to make it easier to compare
between them at this first iteration. Future optimizations
will probably be needed once we start modifying the SOF
side to utilize the new IPC message service API.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The IPC is only needed for old hardware earlier than CAVS 2.5.
They are no longer supported in the tree as their board configs
have been removed. So there is no need to do IPC anymore.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
On ACE, the CPU halting requires the cooperation of the PM
subsys to set the CPU to SOFT_OFF. The mechanism has not
been implemented in the smoke test. So skip the halting test
on ACE for now.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The 4th CPU test tries to gauge tight loop performance. However,
it has been observed occasionally that the calculated would go
over just a bit. The threshold was 3, and the observed ratio
has been bouncing between 2.9 and 3.1. So up the threshold
a little bit to account for that.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Fix complier warning about using abs() with unsigned value.
So typecast it into signed 32-bit value first before feeding it
to abs(). The clock on DSP is not fast enough to need 64-bit
math for the extra one signed bit as 32-bit value.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This adds ACE boards to the allowed platforms so they can
be tested.

Note that this only adds boards that I have tested to run
correctly with the tests.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This updates the Intel Audio DSP smoke test to use the new
IPC API based on IPC message service. The old API is still
being tested for now until all users of the old API has
moved to the new one.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This adds documentation for the newly introduced IPC message
service APIs.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
@dcpleung dcpleung force-pushed the intel_adsp/rework_ipc branch from 190f98c to fd6d222 Compare July 19, 2025 00:55
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Architecture Review Discussion in the Architecture WG required area: IPC Inter-Process Communication
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

5 participants